//
//  UILabel+Extension.swift
//  sinaweibo
//
//  Created by mac on 15/11/12.
//  Copyright © 2015年 mac. All rights reserved.
//

import UIKit

extension UILabel {

    convenience init(title: String, size: CGFloat, color: UIColor, margin:CGFloat = 0) {
        self.init()
        
        text = title
        textAlignment = NSTextAlignment.Center
        font = UIFont.systemFontOfSize(size)
        if margin != 0{
            preferredMaxLayoutWidth = screenW - 2 * margin
            textAlignment = .Left
        }
        numberOfLines = 0
        textColor = color
        sizeToFit()
    }
}
